<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>财政支付查询系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" href="<%=path%>/static/layui/css/layui.css"/>
    <script src="<%=path%>/static/iconfont/iconfont.js"></script>
    <script type="text/javascript" src="<%=path%>/static/jquery/jquery-3.1.0.js"></script>
    <script type="text/javascript" src="<%=path%>/static/layui/layui.js"></script>
    <script src="<%=path%>/static/echarts/echarts.js"></script>
    <style>
        .layui-form-label {
            width: 120px;
        }
        .layui-input-block {
            margin-left: 150px;
        }
        th div {
            text-align: center;
        }
        .layui-btn {
            background-color: #16b777;
        }
        .layui-btn-danger {
            background-color: #ff5722;
        }
        .layui-laypage .layui-laypage-curr .layui-laypage-em {
            background-color: #16b777;
        }
    </style>
</head>
<body>
<div class="layui-container" style="width: 100%;padding: 20px;">
        <div class="layui-row">
            <div class="layui-form">
                <form id="searchForm" class="layui-form" action="" lay-filter="searchForm">
                    <div class="layui-col-xs3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">指标摘要</label>
                            <div class="layui-input-block">
                                <input id="zbzy" type="text" name="zbzy" placeholder="请输入" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">部门经济分类</label>
                            <div class="layui-input-block">
                                <input id="bmjjfl" type="text" name="bmjjfl" placeholder="请输入" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">政府经济分类</label>
                            <div class="layui-input-block">
                                <input id="zfjjfl" type="text" name="zfjjfl" placeholder="请输入" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">支出功能分类</label>
                            <div class="layui-input-block">
                                <input id="zcgnfl" type="text" name="zcgnfl" placeholder="请输入" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">资金性质</label>
                            <div class="layui-input-block">
                                <input id="zjxz" type="text" name="zjxz" placeholder="请输入" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">项目</label>
                            <div class="layui-input-block">
                                <input id="xm" type="text" name="xm" placeholder="请输入" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">指标文号</label>
                            <div class="layui-input-block">
                                <input id="zbwh" type="text" name="zbwh" placeholder="请输入" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs3">
                        <button type="button" class="layui-btn layui-bg-blue" onclick="search()" style="margin-left: 150px;background-color: #004788 !important;">检索</button>
                    </div>
                    <input type="hidden" name="zbmk" value="${key}"/>
                </form>
            </div>
        </div>
        <div class="layui-form" id="table-list">
            <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
        </div>
</div>
<script>
    let form = layui.form;
    let table = layui.table;
    let layer = layui.layer;
    var laydate = layui.laydate;

    form.render();

    $(function() {
        search();
        form.render();
    })

    function search() {
        let data = form.val("searchForm");
        table.render({
            method: 'post',
            elem: '#dataTable',
            url: '<%=path%>/api/zbpageList',
            where: data,
            cellMinWidth: 80,
            loading: true,
            page: true,
            totalRow: true,
            limit: 15,
            limits: [10, 20, 30, 50, 100],
            cols: [[
                {type: 'numbers', width: '4%', minWidth: 30, title: '序号', fixed: 'left'},
                {field: 'id', hide: true, fixed: 'left'},
                {field: 'zbmk', width: '10%', minWidth: 100, title: '指标模块', align: 'center'},
                {field: 'ysdw', width: '10%', minWidth: 100, title: '预算单位', align: 'center'},
                {field: 'ysje', width: '10%', minWidth: 100, title: '预算金额', align: 'right'},
                {field: 'zbje', width: '10%', minWidth: 100, title: '指标金额', align: 'right'},
                {field: 'kyye', width: '10%', minWidth: 100, title: '可用余额', align: 'right'},
                {field: 'zbzy', width: '15%', minWidth: 100, title: '指标摘要', align: 'left'},
                {field: 'bmjjfl', width: '10%', minWidth: 100, title: '部门经济分类', align: 'center'},
                {field: 'zfjjfl', width: '10%', minWidth: 100, title: '政府经济分类', align: 'center'},
                {field: 'zcgnfl', width: '10%', minWidth: 100, title: '支出功能分类', align: 'center'},
                {field: 'zjxz', width: '10%', minWidth: 100, title: '资金性质', align: 'center'},
                {field: 'xm', width: '10%', minWidth: 100, title: '项目', align: 'center'},
                {field: 'sfbhzfcg', width: '10%', minWidth: 100, title: '是否包含政府采购', align: 'center'},
                {field: 'zblx', width: '10%', minWidth: 100, title: '指标类型', align: 'center'},
                {field: 'zbwh', width: '10%', minWidth: 100, title: '指标文号', align: 'center'},
                {field: 'zffs', width: '10%', minWidth: 100, title: 'U8指标文号', align: 'center'},
                {field: 'sfzfcg', width: '8%', minWidth: 100, title: '支付方式', align: 'center'},
                {field: 'zbglcs', width: '10%', minWidth: 100, title: '指标管理处室', align: 'center'},
                {field: 'xmmx', width: '10%', minWidth: 100, title: '项目明细', align: 'center'},
                {field: 'xmgl', width: '10%', minWidth: 100, title: '项目归类', align: 'center'},
                {field: 'sjwh', width: '10%', minWidth: 100, title: '上级文号', align: 'center'},
                {field: 'gzbs', width: '10%', minWidth: 100, title: '工资标识', align: 'center'},
                {field: 'zjzdbs', width: '10%', minWidth: 100, title: '直达资金标识', align: 'center'},
                {field: 'zjbs', width: '10%', minWidth: 100, title: '资金标识', align: 'center'},
                {field: 'ysjc', width: '10%', minWidth: 100, title: '预算级次', align: 'center'},
                {field: 'zjglcs', width: '8%', minWidth: 100, title: '资金管理处室', align: 'center'},
            ]]
        });
    }

    function view(id) {
        layer.open({
            title: "单据明细",
            type: 2, // page 层类型
            anim: -1, // 0-6 的动画形式，-1 不开启
            isOutAnim: false,
            content: "<%=path%>/api/detailPage.html?id=" + id,
            area: ["99%", "99%"],
            shade: 0.6, // 遮罩透明度
            shadeClose: false, // 点击遮罩区域，关闭弹层
            success: function (layero, index) {
                let frameWindow = layero.find('iframe')[0].contentWindow;
                //子窗口关闭父窗口
                frameWindow._parentLayerWindow = window;
            }
        });
    }

    function exit_() {
        layer.confirm('确认退出吗?', function (index) {
            $.ajax({
                type: 'get',
                url: '<%=path%>/login/exit',
                success: function(rs) {
                    if (rs.code == 200) {
                        window.location.href = '<%=path%>/login/login.html';
                    }
                }
            })
            layer.close(index);
        });
    }
</script>
<script type="text/html" id="codeTemplate">
    <a href="JAVASCRIPT:view('{{d.id}}')" style="color: #004788;font-weight: bolder;text-decoration: underline;">{{d.zfdjlx}}</a>
</script>
<script type="text/html" id="zfztTemplate">
    {{#  if(d.zfzt == 0){ }}
    <a class="layui-btn layui-btn-normal layui-btn-xs">&emsp;待支付&emsp;</a>
    {{#  } else  if(d.zfzt == 1){ }}
    <a class="layui-btn layui-btn-succ layui-btn-xs">&emsp;已制单&emsp;</a>
    {{#  } else  if(d.zfzt == 2){ }}
    <a class="layui-btn layui-btn-danger layui-btn-xs">&emsp;制单失败&emsp;</a>
    {{#  } }}
</script>
<script type="text/html" id="xmdmTemplate">
    {{d.xmdm + ' ' + d.xmmc}}
</script>
<script type="text/html" id="zbzyTemplate">
    {{d.zbid + ' ' + d.zbzy}}
</script>
<script type="text/html" id="ysxmdmTemplate">
    {{d.ysxmdm + ' ' + d.ysxmmc}}
</script>
<script type="text/html" id="zjxzdmTemplate">
    {{d.zjxzdm + ' ' + d.zjxzmc}}
</script>
<script type="text/html" id="whdmTemplate">
    {{d.whdm + ' ' + d.whmc}}
</script>
<script type="text/html" id="sfzfcgTemplate">
    {{#  if(d.zfzt == 0){ }}
    <a class="layui-btn layui-btn-normal layui-btn-xs">&emsp;否&emsp;</a>
    {{#  } else  if(d.zfzt == 1){ }}
    <a class="layui-btn layui-btn-succ layui-btn-xs">&emsp;是&emsp;</a>
    {{#  } }}
</script>
<script type="text/html" id="doubtTemplate">
    {{#  if(d.doubt == 1){ }}
    <a class="layui-btn layui-btn-danger layui-btn-xs">&emsp;是&emsp;</a>
    {{#  } else { }}
    <a class="layui-btn layui-btn-succ layui-btn-xs">&emsp;否&emsp;</a>
    {{#  } }}
</script>
</body>
</html>
